<template>
  <div class="bg-white rounded-lg p-5 h-full flex flex-col">
    <div>
      <div class="font-bold text-lg mb-4">随机生成任务</div>
      <el-form ref="form" :model="editForm">
        <el-row>
          <el-col :span="12">
            <el-form-item
              label="计划完成时间"
              prop="planCompletionTime"
              label-width="100px"
            >
              <el-date-picker
                v-model="editForm.planCompletionTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="datetime"
                placeholder="选择日期时间"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
       

        <el-table
          v-loading="loading"
          :data="enterpriseInfoList"
          border
          @selection-change="enterpriseInfoSelectionChange"
        >
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column label="名称" align="center" prop="enterpriseName" />
          <el-table-column
            label="统一信用代码/登记号"
            align="center"
            prop="creditCode"
          />
          <el-table-column
            label="类型"
            align="center"
            prop="typeListName"
            width="180px"
          >
            <!--        <template slot-scope="scope">
                        <dict-tag :options="dict.type.enterprise_info_type" :value="scope.row.type"/>
                      </template>-->
          </el-table-column>
          <el-table-column
            label="类别"
            align="center"
            prop="categoryListName"
          />
          <el-table-column label="所在镇/街道" align="center" prop="town" />
          <el-table-column
            label="量化分级评定等级"
            align="center"
            prop="town2222222"
          />
          <el-table-column label="详细地址" align="center" prop="addr" />
          <el-table-column
            label="联系电话"
            align="center"
            prop="contactNumber"
          />
        </el-table>

        <pagination
          v-show="enterpriseInfoTotal > 0"
          :total="enterpriseInfoTotal"
          :page.sync="enterpriseInfoQueryParams.pageNum"
          :limit.sync="enterpriseInfoQueryParams.pageSize"
          @pagination="getHospitalList"
        />
      </el-form>
    </div>
    <div class="mt-4">
      <el-button @click="cancel">返回</el-button>
      <el-button type="primary" @click="submit">保存</el-button>
    </div>
  </div>
</template>

<script>
import { userList } from "@/api/system/user";
export default {
  
  mixins: [],
  components: {},
  props: {},
  data() {
    return {
      enterpriseInfoForm: {},
      zpEnterpriseInfoIdList: [],
      planCompletionTime: undefined,
      supervisorId: undefined,
      supervisor: undefined,
      userList: [],
      enterpriseInfoTotal: 0,
      enterpriseInfoQueryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      loading: false,
      editForm: {
        planCompletionTime: null,
        supervisorId: null,
      },
      hospital: [],
      enterpriseInfoList: [],
    };
  },
  computed: {},
  watch: {},
  created() {
   
    this.getHospitalList();
  },
  mounted() {},
  methods: {
    submit() {},
    cancel() {
        this.$router.back();
    },
    getHospitalList() {},
    
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    // 多选框选中数据
    enterpriseInfoSelectionChange(selection) {
      console.log("enterpriseInfoSelectionChange", selection);
      this.enterpriseInfoForm.zpEnterpriseInfoIdList = selection.map(
        (item) => item.id
      );
    },

    supervisorSelectChange(val) {
      //选中的数据和options进行匹配
      var obj = {};
      obj = this.userList.find(function (i) {
        return i.userId === val;
      });
      //在change中获取到整条对象数据
      this.enterpriseInfoForm.supervisor = obj.userName;
    },
    getTaskInfoEnterpriseInfoList() {
      taskInfoEnterpriseInfoList(this.enterpriseInfoQueryParams).then(
        (response) => {
          this.enterpriseInfoList = response.rows;
          this.enterpriseInfoTotal = response.data.total;
        }
      );
    },
  },
};
</script>

<style scoped lang="scss"></style>
